<?php

class Application_Form_People extends Zend_Form
{

    public function init()
    {
        $this->setName('people');
        $id = new Zend_Form_Element_Hidden('person_id');
        $id->addFilter('Int');
        $death_reason= new Zend_Form_Element_Text('death_reason');
        $death_reason->setLabel($this->getView()->translate('death_reason'))
                ->setRequired(true)
                ->addFilter('StripTags')
                ->addFilter('StringTrim');
        $gender= new Zend_Form_Element_Select('gender');
        $gender->setLabel($this->getView()->translate('Gender'))
                ->addMultiOptions(array(
                'M' => 'Male',
                'F' => 'Female' ))
                ->setRequired(true)
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->addValidator('NotEmpty');
        $mother_id = new Zend_Form_Element_Text('mother_id');
        $mother_id->setLabel($this->getView()->translate('mother_id'))
                ->setRequired(true)
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->addValidator('NotEmpty');
        $father_id = new Zend_Form_Element_Text('father_id');
        $father_id->setLabel($this->getView()->translate('father_id'))
                ->setRequired(true)
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->addValidator('NotEmpty'); 
        $narrative= new Zend_Form_Element_Text('narrative');
        $narrative->setLabel($this->getView()->translate('narrative'))
                ->setRequired(true)
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->addValidator('NotEmpty');
        $updated = new Zend_Form_Element_Text('updated');
        $updated->setLabel($this->getView()->translate('updated'))
                ->setRequired(true)
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->addValidator('NotEmpty');
        $creator_id = new Zend_Form_Element_Text('creator_id');
        $creator_id->setLabel($this->getView()->translate('creator_id'))
                ->setRequired(true)
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->addValidator('NotEmpty');
        $created = new Zend_Form_Element_Text('created');
        $created->setLabel($this->getView()->translate('created'))
                ->setRequired(true)
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->addValidator('NotEmpty');
        $editor_id = new Zend_Form_Element_Text('editor_id');
        $editor_id->setLabel($this->getView()->translate('editor_id'))
                ->setRequired(true)
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->addValidator('NotEmpty');
        
        $password = new Zend_Form_Element_Password('password');
        $password->setLabel($this->getView()->translate('Password'))
                ->setRequired(true)
                ->addFilter('StripTags')
                ->addFilter('StringTrim')
                ->addValidator('NotEmpty');
        
        // Set the method for the display form to POST
        $this->setMethod('post');
 
        // Add an email element
        $this->addElement('text', 'email', array(
            'label'      => 'Your email address:',
            'required'   => true,
            'filters'    => array('StringTrim'),
            'validators' => array(
                'EmailAddress',
            )
        ));
 
        // Add the comment element
        $this->addElement('textarea', 'comment', array(
            'label'      => 'Please Comment:',
            'required'   => true,
            'validators' => array(
                array('validator' => 'StringLength', 'options' => array(0, 20))
                )
        ));
 
        // Add a captcha
        $this->addElement('captcha', 'captcha', array(
            'label'      => 'Please enter the 5 letters displayed below:',
            'required'   => true,
            'captcha'    => array(
                'captcha' => 'Figlet',
                'wordLen' => 5,
                'timeout' => 300
            )
        ));
 
        // Add the submit button
        $this->addElement('submit', 'submit', array(
            'ignore'   => true,
            'label'    => 'Sign Guestbook',
        ));
 
        // And finally add some CSRF protection
        $this->addElement('hash', 'csrf', array(
            'ignore' => true,
        ));
        
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setAttrib('id', 'submitbutton');
        
        $this->addElements(array($id, $death_reason, $gender, $mother_id, $father_id, $narrative, $updated, $creator_id, $created, $editor_id, $submit));
    
    }


}

